package com.itheima.springboot_24_mq.controller;

import com.itheima.springboot_24_mq.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController //根据method执行不同方法
@RequestMapping("/orders")
public class OrderController {
    @Autowired
    private OrderService orderService;
    @PostMapping("{id}") //路径里带参数
    public void order(@PathVariable String id){
        System.out.println("Controller 订单开始");
        orderService.order(id);//把要发送短信的id放入队列中
        System.out.println("Controller order 处理完了");
    }
}
